int is_prime(int number) {
    if (number < 2) {
        return 0;
    }
    for (int i = 2; i <= (int)sqrt(number) + 1; i++) {
        if (number % i == 0) {
            return 0;
        }
    }
    return 1;
}

void find_closest_prime_number(char* input_string) {
    char* number_words[3];
    int number_mapping[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    int number = 0;
    int i = 0;

    number_words[0] = strtok(input_string, " ");
    while (number_words[i] != NULL) {
        for (int j = 0; j < 10; j++) {
            if (strcmp(number_words[i], "zero") == 0) {
                number = number * 10 + number_mapping[0];
                break;
            } else if (strcmp(number_words[i], "one") == 0) {
                number = number * 10 + number_mapping[1];
                break;
            } else if (strcmp(number_words[i], "two") == 0) {
                number = number * 10 + number_mapping[2];
                break;
            } else if (strcmp(number_words[i], "three") == 0) {
                number = number * 10 + number_mapping[3];
                break;
            } else if (strcmp(number_words[i], "four") == 0) {
                number = number * 10 + number_mapping[4];
                break;
            } else if (strcmp(number_words[i], "five") == 0) {
                number = number * 10 + number_mapping[5];
                break;
            } else if (strcmp(number_words[i], "six") == 0) {
                number = number * 10 + number_mapping[6];
                break;
            } else if (strcmp(number_words[i], "seven") == 0) {
                number = number * 10 + number_mapping[7];
                break;
            } else if (strcmp(number_words[i], "eight") == 0) {
                number = number * 10 + number_mapping[8];
                break;
            } else if (strcmp(number_words[i], "nine") == 0) {
                number = number * 10 + number_mapping[9];
                break;
            }
        }
        number_words[++i] = strtok(NULL, " ");
    }

    if (i != 3 || number < 100 || number > 999) {
        printf("incorrect input\n");
        return;
    }

    int lower_prime = number;
    int upper_prime = number;
    while (1) {
        if (is_prime(lower_prime)) {
            printf("%d\n", lower_prime);
            return;
        }
        if (is_prime(upper_prime)) {
            printf("%d\n", upper_prime);
            return;
        }
        lower_prime--;
        upper_prime++;
    }
}

int main() {
    char input_string[100];
    printf("enter three numbers in English: ");
    fgets(input_string, 100, stdin);
    input_string[strcspn(input_string, "\n")] = '\0';
    find_closest_prime_number(input_string);
    return 0;
}